import React from "react";
import {
  BrowserRouter, browserHistory, Router, Route,
} from "dva/router";
import dva from "dva";
import createHistory from "history/createBrowserHistory";
import Demo from "view/demo";
import { message } from "antd";

const app = dva({
  history: createHistory(),
  // initialState: decryptedData,
  // 抛出异常，统一到DVA异常回调中处理
  onError: (error) => {
    message.error(error.message);
  },
});

// models.forEach(model => app.model(Object.assign({}, model.component)))

app.router(() => (
  <BrowserRouter history={browserHistory}>
    <Router history={createHistory()}>
      <Route path="/" component={Demo} />
    </Router>
  </BrowserRouter>
));
app.start("#app");
